<!-- 电度表综合信息 -->
<template>
	<div class="dashboard-container">
		<page-header :headerTitle="$t('message.electMeterNews.pageTitle')" :showWeather="false" />

		<div class="summary-panel">
			<!-- 逆变器状态统计 -->
			<div class="panel-section station-count">
				<div class="metric-item">
					<span class="metric-label">{{ $t('message.electMeterNews.pageElectMeterTotal') }}</span>
					<span class="metric-value">13</span>
					<span class="metric-unit">{{ $t('message.electMeterNews.pageUnit') }}</span>
					<span class="filter-label">{{ $t('message.electMeterNews.pagePower') }}</span>
					<span style="color: green; font-weight: 500; margin: 0 8px">11</span>
					<span class="metric-unit">{{ $t('message.electMeterNews.pageUnit') }}</span>
				</div>
				<div class="metric-item">
					<span class="metric-label">{{ $t('message.electMeterNews.pageStop') }}</span>
					<span class="metric-value">13</span>
					<span class="metric-unit">{{ $t('message.electMeterNews.pageUnit') }}</span>
					<span class="filter-label">{{ $t('message.electMeterNews.pagePhone') }}</span>
					<span style="color: red; font-weight: 500; margin: 0 8px">11</span>
					<span class="metric-unit">{{ $t('message.electMeterNews.pageUnit') }}</span>
				</div>
			</div>

			<div style="text-align: center">
				<img src="../../assets/image8.png" alt="分隔线" style="height: 5rem" />
			</div>

			<!-- 子站选择 -->
			<div class="panel-section">
				<p class="section-label">{{ $t('message.electMeterNews.pageStation') }}</p>
				<el-select v-model="statusValue" :placeholder="$t('message.form.pageSelectHolder')" size="small" style="width: 100%" class="custom-select">
					<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
				</el-select>
			</div>

			<div style="text-align: center">
				<img src="../../assets/image8.png" alt="分隔线" style="height: 5rem" />
			</div>

			<!-- 逆变器状态分类 -->
			<div class="panel-section">
				<p class="section-label">{{ $t('message.electMeterNews.pageStatusClass') }}</p>
				<el-select v-model="statusValue" :placeholder="$t('message.form.pageSelectHolder')" size="small" style="width: 100%" class="custom-select">
					<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
				</el-select>
			</div>

			<div style="text-align: center">
				<img src="../../assets/image8.png" alt="分隔线" style="height: 5rem" />
			</div>

			<!-- 参数设置 -->
			<div class="panel-section watt-metrics">
				<div class="metric-item">
					<span class="filter-label">{{ $t('message.electMeterNews.pageDiscrete') }} >=</span>
					<el-input size="small" v-model="minWattOutput" class="metric-input custom-input" :placeholder="$t('message.form.pageInputHolder')" />
				</div>
				<div class="metric-item">
					<span class="filter-label">{{ $t('message.electMeterNews.pageCurrent') }} <=</span>
					<el-input size="small" v-model="maxWattOutput" class="metric-input custom-input" :placeholder="$t('message.form.pageInputHolder')" />
				</div>
			</div>
		</div>

		<div class="table-container">
			<TableCustom :indexIsShow="true" :total="total" :hasToolbar="false" :tableData="tableData" :tableOption="tableOption" />
		</div>
	</div>
</template>

<script lang="ts">
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import TableCustom from '../../components/table/index.vue';
import { onMounted, defineComponent, reactive, toRefs, computed } from 'vue';
import pageHeader from '../../components/pageHeader/index.vue';

export default defineComponent({
	name: 'electMeterNews',

	components: { pageHeader, TableCustom },

	setup(props, { emit }) {
		const { t } = useI18n();
		const state = reactive({
			total: 0,
			pageSize: 10,
			pageNum: 1,
			options: [
				{ value: '1', label: '选项1' },
				{ value: '2', label: '选项2' },
				{ value: '3', label: '选项3' },
				{ value: '4', label: '选项4' },
			],
			statusValue: '1',
			statusOptions: [
				{ value: '1', label: '选项1' },
				{ value: '2', label: '选项2' },
				{ value: '3', label: '选项3' },
				{ value: '4', label: '选项4' },
			],
			minDailyHours: '',
			maxDailyHours: '',
			minWattOutput: '',
			maxWattOutput: '',
			tableData: [
				{
					name: '逆变器1',
				},
			],
		});

		const router = useRouter();
		const oneStandsClick = (val: any) => {
			router.push({
				path: '/gatherControlManage/oneStandNews',
				query: { name: val.name },
			});
		};

		// table表头tableOption国际化
		const tableOption = computed(() => [
			{ prop: 'name', label: t('message.electMeterNews.pageSubstation') },
			{ prop: 'phone', label: t('message.electMeterNews.pageElectMeter') },
			{ prop: 'phone', label: t('message.electMeterNews.pageRatio') },
			{ prop: 'phone', label: t('message.electMeterNews.pageCommStatus') },
			{ prop: 'phone', label: t('message.electMeterNews.pageActivePower') },
			{ prop: 'phone', label: t('message.electMeterNews.pageActivePowerPeak') },
			{ prop: 'phone', label: t('message.electMeterNews.pageActivePowerValley') },
			{ prop: 'phone', label: t('message.electMeterNews.pageActivePowerAverage') },
			{ prop: 'phone', label: t('message.electMeterNews.pageReactivePower') },
			{ prop: 'phone', label: t('message.electMeterNews.pageReactivePowerPeak') },
			{ prop: 'phone', label: t('message.electMeterNews.pageReactivePowerValley') },
			{ prop: 'phone', label: t('message.electMeterNews.pageReactivePowerAverage') },
		]);

		onMounted(() => {});

		return {
			tableOption,
			oneStandsClick,
			...toRefs(state),
		};
	},
});
</script>

<style lang="scss" scoped>
.summary-panel {
	width: 100%;
	display: grid;
	height: 6.5rem;
	padding: 0.3rem;
	grid-gap: 0.3rem;
	line-height: 2rem;
	margin-bottom: 0.5rem;
	background-color: #0a1a32;
	grid-template-columns: 4fr 1fr 5fr 1fr 7fr 1fr 7fr;
}

.panel-section {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 0 1rem;
}

.section-label {
	margin-bottom: 0.6rem;
	font-size: 14px;
	color: #fff;
	white-space: nowrap;
}

.metric-item {
	display: flex;
	align-items: center;
	white-space: nowrap;

	.metric-label {
		font-size: 1rem;
	}

	.metric-value {
		color: #5fcffa;
		font-weight: 500;
		margin: 0 1rem;
	}

	.metric-unit {
		margin-right: 1rem;
	}

	.filter-label {
		margin: 0 1rem;
		color: #fff;
		font-size: 1rem;
	}
}
</style>
